package pers.course.others;

import java.util.Scanner;

public class SubString {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        for (int i = 0; i < n; i++) {
            int m = 1;
            String a = s.next();
            String B = s.nextLine();
            String A = s.nextLine();
            char[] arr = a.toCharArray();
            char[] Arr = A.toCharArray();
            for (int j = 0; j < Arr.length; j++) {
                if (arr[0] == Arr[j]) {
                    for (int k = 0; k < arr.length; k++) {
                        if (arr[k] != Arr[j + k]) {
                            break;
                        } else {
                            m++;
                        }
                        if (m == arr.length) {
                            System.out.println("true");
                            return;
                        }
                    }
                }
            }
            System.out.println("false");
        }
    }
}